Thread: Char and Strings [beginner]

  1. #1
    Registered User
    Join Date
    Jan 2015
    Location
    ReykjavÃ..k, Iceland, Iceland
    Posts
    2

    Lightbulb Char and Strings [beginner]

    Hello, I'm very new to c programming and I have some background in C# and java. I have a problem with my last homework problem, its like this. I am supposed to read a string from input then determine in that string, which character is the largest, i.e. I think b>e and e>z, e.t.c. If the string is empty I should return '\0'.
    I'm sorry if this is really newbish question but I haven't done any programming in C before and I don't know how to handle strings and characters in C. Thanks in advance and a hope for a quick response.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Have you tried using functions from <stdio.h> such as fgets? You should start with something simple, e.g., a program that reads a string from the user and prints that string to standard output.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2015
    Location
    ReykjavÃ..k, Iceland, Iceland
    Posts
    2
    Thanks, I looked it over and found the solution, I wasn't using the string correctly. Thanks for the input.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner: malloc and array of strings
    By 0ooo0 in forum C Programming
    Replies: 6
    Last Post: 03-18-2013, 08:19 AM
  2. Beginner help about strings
    By yildiz.a in forum C Programming
    Replies: 41
    Last Post: 05-18-2009, 10:41 PM
  3. Replies: 2
    Last Post: 04-29-2009, 10:13 AM
  4. beginner question about strings
    By gp364481 in forum C Programming
    Replies: 4
    Last Post: 09-05-2008, 06:31 PM
  5. A beginner passing strings
    By jamjar in forum C Programming
    Replies: 2
    Last Post: 09-01-2002, 12:50 AM

Tags for this Thread